(function () {
    'use strict';

    // Usage:
    //
    // Creates:
    //

    angular
        .module('yky.components')
        .component('examSideBar', {
            templateUrl: './exam.sidebar.html',
            controllerAs: 'vm',
            controller: ExamSidebarController,
            bindings: {
                onSelect:'&'
            }
        });

    ExamSidebarController.inject = ['$http'];
    function ExamSidebarController($http) {
        var vm = this;
        vm.selected,
        $http
            .get('/data/exams.json')
            .then(res => {
                vm.exams = res.data;
                vm.selected = vm.exams[0];
            })
        vm.select = function(exam){
            vm.onSelect({
                $value:exam
            })
            vm.selected = exam;
        }
        ////////////////

        vm.onInit = function () {};
        vm.onChanges = function (changesObj) {};
        vm.onDestory = function () {};
    }
})();